# Maintainer: Ruben Agin <phabrics@phabrics.com>
_realname=tme
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.12rc11
pkgrel=1
pkgdesc="The Machine Emulator, or ${_realname}, provides a general-purpose framework for computer emulation. (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('GPL3')
url="http://nme.osdn.io"
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
	     "${MINGW_PACKAGE_PREFIX}-SDL2")
depends=("${MINGW_PACKAGE_PREFIX}-gtk4"
	 "${MINGW_PACKAGE_PREFIX}-libvncserver"
	 "${MINGW_PACKAGE_PREFIX}-libltdl")
source=("https://osdn.net/dl/nme/${_realname}-${pkgver}.tar.xz")
sha256sums=('ea72a457e0fe8144f985e0a5bf848cd5872a807f47fad492b9e1e5fbd7c173bf')
options=('libtool')

build()
{
    mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

    ../"${_realname}-${pkgver}"/configure \
      --prefix="${MINGW_PREFIX}" \
      --build="${MINGW_CHOST}" \
      --host="${MINGW_CHOST}" \
      --enable-hosts="gtk rfb openvpn" \
      --disable-ltdl-install

    make
}

package()
{
    cd "${srcdir}/build-${MSYSTEM}"
    make install DESTDIR="${pkgdir}"
    install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
